<?php

use console\db\Migration;
use yii\db\Query;

/**
 * 更新参与日志-球迷回馈
 * 
 * @author emhome <emhome@163.com>
 * @since 1.0
 */
class m300200_100044_t_activity_attend_log extends Migration {

    /**
     * @inheritdoc
     */
    public $sourceDb = 'olddb';

    /**
     * @inheritdoc
     */
    public function buildQuery() {
        return (new Query())->from('{{%' . $this->sourceTable . '}}')->andWhere([
            'status' => 1,
            'actid' => 1,
        ])->groupBy('uid');
    }

    /**
     * @inheritdoc
     */
    public function getTransferOptions() {
        return [
            'table' => [
                'activity_attend_log' => 'activity_draw_chance',
            ],
            'columns' => [
                'activity_id' => 'actid',
                'user_id' => 'uid',
                'created_at' => 'inputtime',
                'updated_at' => 'updatetime',
            ],
        ];
    }

}
